home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.4 Applications 1997 August / SGI IRIX 6.4 Applications 1997 August.iso / dist / mmailp.idb / usr / lib / Zmail / bin / sh-versions / showpicture.z / showpicture
Encoding:
Text File  |  1997-01-22  |  3.3 KB  |  129 lines

  1. :
  2. # Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
  3. # Permission to use, copy, modify, and distribute this material 
  4. # for any purpose and without fee is hereby granted, provided 
  5. # that the above copyright notice and this permission notice 
  6. # appear in all copies, and that the name of Bellcore not be 
  7. # used in advertising or publicity pertaining to this 
  8. # material without the specific, prior written permission 
  9. # of an authorized representative of Bellcore.  BELLCORE 
  10. # MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
  11. # OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
  12. # WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
  13.  
  14. # Conversion from C shell to Bourne shell by Z-Code Software Corp.
  15. # Conversion Copyright (c) 1992 Z-Code Software Corp.
  16. # Permission to use, copy, modify, and distribute this material
  17. # for any purpose and without fee is hereby granted, provided
  18. # that the above copyright notice and this permission notice
  19. # appear in all copies, and that the name of Z-Code Software not
  20. # be used in advertising or publicity pertaining to this
  21. # material without the specific, prior written permission
  22. # of an authorized representative of Z-Code.  Z-CODE SOFTWARE
  23. # MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
  24. # OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS",
  25. # WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
  26.  
  27. # Brought into line with metamail 2.7 beta release Csh version
  28. #    Dave Shield    February 1994
  29.  
  30. if [ -z "$METAMAIL_TMPDIR" ]
  31. then
  32.     METAMAIL_TMPDIR=/tmp
  33. fi
  34.  
  35. if test -z "${X_VIEWER:-}"
  36. then
  37.     X_VIEWER="xloadimage -view -quiet -geometry +1+1"
  38. # X_VIEWER="xv -geometry +1+1"
  39. fi
  40.  
  41. if test "$1" = "-viewer" -a ! -z "$2"
  42. then
  43.     X_VIEWER="$2"
  44.     shift
  45.     shift
  46. fi
  47.  
  48. if test -z "${MM_NOTTY:-}"
  49. then
  50.     MM_NOTTY=0
  51. fi
  52. if test -z "${DISPLAY:-}"
  53. then
  54.     echo ""
  55.     echo This message contains a picture, which can currently only be
  56.     echo viewed when running X11.  If you read this message while running
  57.     echo X11, you will be able to see the picture properly.
  58.     if test $MM_NOTTY -eq 1
  59.     then
  60.         fname=$METAMAIL_TMPDIR/sp.$$
  61.         echo "The picture is being automatically stored in the file $fname"
  62.         echo "If you do not want this file, please delete it."
  63.     else
  64.         echo-n "Do you want to write the picture out to a file [y] ? "
  65.         read ANS
  66.         case "$ANS" in
  67.             [Nn]*)    exit 0;;
  68.             *)    looping=1
  69.             while test $looping -eq 1
  70.             do
  71.                 echo-n "File name: "
  72.                 read fname
  73.                 if test -f $fname
  74.                 then
  75.                     echo "$fname already exists. Try again"
  76.                 else
  77.                     looping=0
  78.                 fi
  79.             done ;;
  80.         esac
  81.     fi
  82.     cp $1 $fname
  83.     if test $? -eq 0
  84.     then
  85.         echo Wrote file $fname
  86.     fi
  87.     exit 0
  88. fi
  89.  
  90. if test -z "$1"
  91. then
  92.     SQUIRREL=${METAMAIL_TMPDIR}/sp.$$
  93.     cat > $SQUIRREL
  94. else
  95.     # this doesn't actually get used so we don't have to worry
  96.     # about the quoting being wrong, really.
  97.     SQUIRREL="$*"
  98. fi
  99.  
  100.  
  101. echo NOTE: TO MAKE THE PICTURE WINDOW GO AWAY, JUST TYPE 'q' IN IT.
  102. if test -z "$1"
  103. then
  104.     echo "==> TO SAVE THIS IMAGE, COPY THE FILE $SQUIRREL BEFORE EXITING"
  105.     echo ""
  106.     $X_VIEWER $SQUIRREL
  107.     rm $SQUIRREL
  108. else
  109.     for i in "$@"
  110.     do
  111.         echo "==> TO SAVE THIS IMAGE, COPY THE FILE $i BEFORE EXITING"
  112.         echo ""
  113.         dir=`dirname $i`
  114.         base=`basename $i`
  115.         if test ! "$base" = "$i"
  116.         then
  117.             cd $dir
  118.         fi
  119.         if ln $i $$.PRESS-q-TO-EXIT  > /dev/null 2>&1
  120.         then
  121.             $X_VIEWER $$.PRESS-q-TO-EXIT
  122.             rm $$.PRESS-q-TO-EXIT 
  123.         else
  124.             $X_VIEWER "$i"
  125.         fi
  126.     done
  127. fi
  128.